Method and system for sharing files among different virtual machine images

ABSTRACT

A system and method comprise steps of a) creating a first virtual image comprising one or more files; b) determining whether there exists a second virtual image that is identical to the first virtual image; c) comparing the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files; d) creating a common file collection comprising the set of common files; f) creating a second version of the first virtual image comprising only files in the first virtual image that are not in the common file collection; and g) creating a second version of the second virtual image comprising only files in the second virtual image that are not in the common file collection.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application relates to improvements on the invention of U.S. patent application Ser. No. 10/795,153, which is hereby incorporated by reference.

STATEMENT REGARDING FEDERALLY SPONSORED-RESEARCH OR DEVELOPMENT

Not Applicable.

INCORPORATION BY REFERENCE OF MATERIAL SUBMITTED ON A COMPACT DISC

Not Applicable.

FIELD OF THE INVENTION

The invention disclosed broadly relates to the field of information processing systems, and more particularly relates to the field of virtual machine images.

BACKGROUND OF THE INVENTION

Virtual machine (VM) software currently enables users to run multiple operating systems on a single physical machine by supporting VM bundles that encapsulate an entire hard disk as well as the state of the system RAM (random-access memory). Users often need to run the multiple VMs based on the same operating system. For example, one may want to run two Microsoft XP operating system images and two Linux operating system images in the same computer. It is wasteful to replicate the same OS system files in all of the XP images or in all of the Linux images. Consider, for example, an upgrade patch to be downloaded for upgrading an application program or the operating system. When multiple images exist, all must be modified to keep them in synchronization. Therefore, there is a need for a method and system that overcomes the above wasteful replication.

SUMMARY OF THE INVENTION

Briefly, according to an embodiment of the invention, a method comprises steps of a) creating a first virtual image comprising one or more files; b) determining whether there exists a second virtual image that is identical to the first virtual image; c) comparing the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files; d) creating a common file collection comprising the set of common files; f) creating a second version of the first virtual image comprising only files in the first virtual image that are not in the common file collection; and g) creating a second version of the second virtual image comprising only files in the second virtual image that are not in the common file collection.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flowchart of a method of creating VM images according to an embodiment of the invention.

FIG. 2 is a high level block diagram showing an information processing system storing OS images according to another embodiment of the invention.

FIG. 3 is a flowchart of a method for applying modification to files according to another embodiment of the invention.

FIG. 4 is a flowchart of a method for applying a modification to a file in all virtual images.

FIG. 5 is a flowchart of another method for applying modifications to files according to another embodiment of the invention.

DETAILED DESCRIPTION

Referring to FIG. 1, there is shown a flowchart of a method 100 according to an embodiment of the invention. Step 102 creates a first virtual image comprising one or more Operating System files. Step 104 determines whether a similar virtual image exists. If no similar image exists, the method 100 ends. If there is an existing (second) virtual image, then in step 106 we point to the newly-created virtual image (first virtual image) as being similar to the existing virtual image (second virtual image). In step 108, we compare the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files. In step 110 we create a third image comprising a set of common files. In step 116 we create a second version of the first virtual image comprising only files in the first virtual image that are not in the file collection. In step 118 we create a second version of the second virtual image comprising only files in the second virtual image that are not in the file collection.

Referring to FIG. 2 , there is shown a high level block diagram showing an information processing system 200 according to another embodiment of the invention. The system 200 comprises a processor (e.g., one or more microprocessors) 202, an input/output subsystem 206 (e.g., including a user interface and a network interface for communicating with other machines within one or more networks). The system 200 also comprises non volatile storage (e.g., hard disk) 204. According to this embodiment of the invention, the storage 204 comprises virtual images XP0, XP1, and XP2. Each of these has Microsoft XP as its core operating system.

When the user creates a new virtual image, he gives it a name and has an idea of what he is going to install on the virtual image. At this time he identifies a similar virtual image, if he already has one. For instance, when he creates the second XP image (XP2) he points it to the first (XP1) as being similar. After that he installs a brand new XP image into XP2, then he runs a diff program that compares all of the files that are in XP1 with the corresponding files that are in XP2 and creates three images: (1) XP0 which has the common files; (2) XP1 which has only the files in XP1 that are not in XP0, and (3) XP2 that has only the files that are in XP2 and not in XP0.

During runtime, files may be modified in either XP1 or XP2. If the modified file actually turns out to be in XP0, it is removed from XP0 and moved into the appropriate XP1 or XP2 virtual image. At any time one may re-run the diff program to move common files to XP0. If two files are different even by one bit, they do not belong in XP0.

By running the diff program periodically one can easily capture identical changes to the two images. One place where an operation is likely to result in identical changes being applied to multiple virtual images is when security patches are applied to the virtual images. One can apply the patch to XP1 and then to XP2 and then rerun the diff program to synchronize the images again.

Alternatively, if a user can download the security patch and apply it while the virtual images are suspended, then the user can directly apply the patch to XP0 and any files in XP1 and XP2, instead of applying the patches one at a time. One may also lock down the core OS part of XP0 (e.g., directories and/or files) and prevent the creation of differences at run time. So users are prevented from modifying any of the core OS files or adding/deleting files in critical directories. Patches may be applied by the central administrator and replicated to all machines, if this mode of operation is supported, it may be advantageous to create XP0 even if we only have one XP1 on a machine. The foregoing sharing technique is specially important for the case where XP1 and XP2 are carried on portable media as described in U.S. patent application Ser. No. 10/795,153 where storage may be more limited than in non-portable computing apparatuses.

Referring to FIG. 3, there is shown a flowchart of a method 300 according to another embodiment of the invention. In step 302 we receive a modification for a file in a virtual image. The modification may take the form of a patch for an application program hosted by the system 200. In step 304 the system 200 makes a determination of whether the patch applies to a file in the shared collection XP0 or in one of the private collections XP1 or XP2. If the same application version is installed in both virtual machines, the file would most likely be in the shared collection since the same (identical) file is used in both virtual machines. If the determination 304 is that a copy of the file exists in the shared collection, then in step 306 the file is copied from that collection and placed in each private collection. In step 312 the file is removed from the shared collection and in step 314 the file is applied to the appropriate private collection. If the determination 304 is negative, the method 300 proceeds to step 308 where the received modification is applied to the target file. In step 310, the method 300 periodically performs step 502 of method 500.

Referring to FIG. 4, there is shown a flowchart of a method 400 according to another embodiment of the invention. A modification is received in step 402. This modification is for a file in all virtual images. In this method 400 the received modification is applied (steps 406 or 410) regardless of whether step 404 determines the existence of the filed to be modified in the shared collection. If the file is in the private collections, the modification is applied to the copies in the private collections.

Referring to FIG. 5, there is shown a flowchart of method 500 according to another embodiment of the invention. This method 500 is applied to resynchronize changes to files applied separately. In step 502 the files in the virtual images XP1 and XP2 are compared with each other. In step 504, all files that are identical copied from XP1 or XP2 into the shared collection XP0. In step 506, the files are deleted from XP1 and XP2. Then the method ends at this point.

Therefore, while there has been described what is presently considered to be the preferred embodiment, it will understood by those skilled in the art that other modifications can be made within the spirit of the invention. 

1. A computer-implemented method comprising steps of: a) creating a first virtual image comprising one or more files; b) determining whether there exists a second virtual image that is similar to the first virtual image; c) comparing the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files; d) creating a common file collection comprising the set of common files; f) creating a second version of the first virtual image comprising only files in the first virtual image that are not in the common file collection; and g) creating a second version of the second virtual image comprising only files in the second virtual image that are not in the common file collection.
 2. The method of claim 1, further comprising: h) receiving, during runtime, a request for modification of a file within a requested one or both of the first virtual image or the second virtual image, wherein the request includes the modification; i) determining whether the file is in the common file collection; j) removing the file from the common file collection if the file is in the common file collection; k) copying the file into both the first and second virtual images; and l) applying the modification to the file in the requested one or both of the first and second virtual images.
 3. The method of claim 1, further comprising periodically comparing the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files.
 4. The method of claim 2, wherein the modification comprises a security patch.
 5. The method of claim 2, wherein the step of receiving a request for modification of a file calls for the modification to be applied to all images and the method further comprises suspending the first and second virtual images, and applying the security patch to the first and second virtual images while the first and second virtual images are suspended, and wherein the patches are directly applied to the common file collection without migrating the files into private collections.
 6. The method of claim 2, wherein the common file collection comprises a core operating system part and the method further comprises locking the core operating system part and preventing modifying any core operating system files or adding and deleting files in specified directories.
 7. The method of claim 5, further comprising receiving a patch from a system administrator to be applied to all virtual machines.
 8. The method of claim 1, further comprising creating a second virtual image, comprising one or more files, wherein the second virtual image is initially empty, if it is determined that there does not exist a second virtual image that is similar to the first virtual image.
 9. An information processing system comprising a processor; a memory; and an input/output subsystem, wherein the processor is configured for: a) creating a first virtual image comprising one or more files; b) determining whether there exists a second virtual image that is similar to the first virtual image; c) comparing the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files; d) creating a common file collection comprising the set of common files; f) creating a second version of the first virtual image comprising only files in the first virtual image that are not in the common file collection; and g) creating a second version of the second virtual image comprising only files in the second virtual image that are not in the common file collection.
 10. The system of claim 9, wherein the processor is further configured for: h) receiving, during runtime, a request for modification of a file within a requested one or both of the first virtual image or the second virtual image, wherein the request includes the modification; i) determining whether the file is in the common file collection; j) removing the file from the common file collection if the file is in the common file collection; k) copying the file into both the first and second virtual images; and l) applying the modification to the file in the requested one or both of the first and second virtual images.
 11. The system of claim 9, wherein the processor is further configured for: periodically comparing the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files.
 12. The system of claim 9 wherein the modification comprises a security patch.
 13. The system of claim 9, wherein receiving a request for modification of a file calls for the modification to be applied to all images and the method further comprises suspending the first and second virtual images, and applying the security patch to the first and second virtual images while the first and second virtual images are suspended, and wherein the patches are directly applied to the common file collection without migrating the files into private collections.
 14. The system of claim 10 wherein the common file collection comprises a core operating system part and the method further comprises locking the core operating system part and preventing modifying any core operating system files or adding and deleting files in specified directories.
 15. The system of claim 13 wherein the processor is further configured for receiving a patch from a system administrator to be applied to all virtual machines.
 16. The system of claim 9 wherein the processor is further configured for creating a second virtual image, comprising one or more files, wherein the second virtual image is initially empty, if it is determined that there does not exist a second virtual image that is identical to the first virtual image.
 17. A computer readable medium comprising program code for: a) creating a first virtual image comprising one or more files; b) determining whether a similar virtual image exists; c) if no similar image exists, creating a second virtual image, comprising one or more files, wherein the second virtual image is initially empty; d) pointing to the first virtual image as similar to the second virtual image; e) installing a new operating system image into the second virtual image; f) comparing the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files; g) creating a third image comprising the set of common files; h) creating a second version of the first virtual image comprising only files in the first virtual image that are not in the common file collection; and i) creating a second version of the second virtual image comprising only files in the second virtual image that are not in the common file collection.
 18. The computer readable medium of claim 17 further comprising code for: h) receiving, during runtime, a request for modification of a file within a requested one or both of the first virtual image or the second virtual image, wherein the request includes the modification; i) determining whether the file is in the common file collection; j) removing the file from the common file collection if the file is in the common file collection; k) copying the file into both the first and second virtual images; and l) applying the modification to the file in the requested one or both of the first and second virtual images.
 19. The computer readable medium of claim 17 further comprising code for: periodically comparing the one or more files of the first virtual image with the one or more files of the second virtual image to determine a set of common files.
 20. The computer readable medium of claim 17 wherein the modification comprises a security patch. 